// https://leetcode.cn/problems/valid-anagram/description/?envType=study-plan-v2&envId=top-interview-150

class Solution {
public:
    bool isAnagram(string s, string t) {
        int m = s.size();
        int n = t.size();

        if (m != n) {
            return false;
        }

        vector<int> mod(26);
        vector<int> target(26);
        for (int i = 0; i < m; i++) {
            mod[s[i] - 'a']++;
            target[t[i] - 'a']++;
        }
        return mod == target;
    }
};